﻿<div class="top-row ps-3 navbar navbar-dark">
    <div class="container-fluid">
        <a class="navbar-brand" href="">BlazorLifecycle</a>
        <button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
            <span class="navbar-toggler-icon"></span>
        </button>
    </div>
</div>

<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu">
    <nav class="flex-column">
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <span class="oi oi-home" aria-hidden="true"></span> 生命周期
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="/1999-9-9">
                <span class="oi oi-home" aria-hidden="true"></span> 生命周期带参
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="index2">
                <span class="oi oi-plus" aria-hidden="true"></span> 子组件
            </NavLink>
        </div>
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="index222/10">
                <span class="oi oi-plus" aria-hidden="true"></span> 子组件带参
            </NavLink>
        </div> 
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="Index22/2999-9-9">
                <span class="oi oi-plus" aria-hidden="true"></span> 子组件带参2
            </NavLink>
        </div> 
        <div class="nav-item px-3">
            <NavLink class="nav-link" href="SwitchBarDemo">
                <span class="oi oi-plus" aria-hidden="true"></span> 子组件初始化
            </NavLink>
        </div> 
    </nav>
</div>

@code {
    private bool collapseNavMenu = true;

    private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;

    private void ToggleNavMenu()
    {
        collapseNavMenu = !collapseNavMenu;
    }
}
